<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>SASAPI</title><script src="../../../quicknav.js" type="text/javascript"></script><script><!--
document.quicknavBasePath="../../../index-files";
//--></script><link href="../../../style.css" title="JavaDoc" rel="stylesheet" type="text/css"/><link href="../../../unnatural.css" title="Unnatural" rel="alternate stylesheet" type="text/css"/><link href="../../../overview-summary.html" title="Overview" rel="top"/><meta name="generator" content="http://www.badgers-in-foil.co.uk/projects/as2api/"/></head><body><pre><span class="lineno" id="1">     1  </span><span class="comment doc">/**
<span class="lineno" id="2">     2  </span> * com.sekati.log.ConsoleStyle
<span class="lineno" id="3">     3  </span> * @version 1.3.5
<span class="lineno" id="4">     4  </span> * @author jason m horwitz | sekati.com
<span class="lineno" id="5">     5  </span> * Copyright (C) 2007  jason m horwitz, Sekat LLC. All Rights Reserved.
<span class="lineno" id="6">     6  </span> * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
<span class="lineno" id="7">     7  </span> */</span>
<span class="lineno" id="8">     8  </span>
<span class="lineno" id="9">     9  </span><span class="key">import</span> com.sekati.display.BaseClip;
<span class="lineno" id="10">    10  </span><span class="key">import</span> com.sekati.draw.Rectangle;
<span class="lineno" id="11">    11  </span><span class="key">import</span> com.sekati.draw.Triangle;
<span class="lineno" id="12">    12  </span><span class="key">import</span> com.sekati.geom.Point;
<span class="lineno" id="13">    13  </span><span class="key">import</span> com.sekati.utils.ClassUtils;
<span class="lineno" id="14">    14  </span><span class="key">import</span> com.sekati.utils.TextUtils; 
<span class="lineno" id="15">    15  </span>
<span class="lineno" id="16">    16  </span><span class="comment doc">/**
<span class="lineno" id="17">    17  </span> * Singleton class defining {@link com.sekati.log.Console} style and layout.
<span class="lineno" id="18">    18  </span> */</span>
<span class="lineno" id="19">    19  </span><span class="key">class</span> com.sekati.log.ConsoleStyle {
<span class="lineno" id="20">    20  </span>
<span class="lineno" id="21">    21  </span>	<span class="key">private</span> <span class="key">static</span> <span class="key">var</span> _instance:ConsoleStyle;
<span class="lineno" id="22">    22  </span>	<span class="key">public</span> <span class="key">var</span> CW:Number = <span class="num_const">900</span>; 
<span class="lineno" id="23">    23  </span>	<span class="comment">// console width</span>
<span class="lineno" id="24">    24  </span>	<span class="key">public</span> <span class="key">var</span> CH:Number = <span class="num_const">500</span>; 
<span class="lineno" id="25">    25  </span>	<span class="comment">// console height</span>
<span class="lineno" id="26">    26  </span>	<span class="key">public</span> <span class="key">var</span> IW:Number = <span class="num_const">889</span>; 
<span class="lineno" id="27">    27  </span>	<span class="comment">// item width</span>
<span class="lineno" id="28">    28  </span>	<span class="key">public</span> <span class="key">var</span> IH:Number = <span class="num_const">12</span>; 
<span class="lineno" id="29">    29  </span>	<span class="comment">// item height</span>
<span class="lineno" id="30">    30  </span>	<span class="key">public</span> <span class="key">var</span> TH:Number = <span class="num_const">14</span>; 
<span class="lineno" id="31">    31  </span>	<span class="comment">// text height</span>
<span class="lineno" id="32">    32  </span>	
<span class="lineno" id="33">    33  </span>	<span class="comment">// style definition</span>
<span class="lineno" id="34">    34  </span>	<span class="key">public</span> <span class="key">var</span> CSS:Object = {
<span class="lineno" id="35">    35  </span>		console:{
<span class="lineno" id="36">    36  </span>			n:<span class="str_const">"___Console"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:CW, h:CH, minW:<span class="num_const">450</span>, minH:<span class="num_const">150</span>, maxW:Stage.width, maxH:Stage.height, bg:{n:<span class="str_const">"bgMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:CW, h:CH, c:0x1D1D1D, a:<span class="num_const">95</span>}, head:{
<span class="lineno" id="37">    37  </span>				n:<span class="str_const">"headMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:CW, h:IH, isDraggable:<span class="key">false</span>, bg:{n:<span class="str_const">"bcMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:CW, h:IH, c:0xFFFFFF, a:<span class="num_const">100</span>}, textfields:{
<span class="lineno" id="38">    38  </span>					head:{n:<span class="str_const">"headTf"</span>, t:<span class="str_const">"com.sekati.log.Console"</span>, url:<span class="str_const">"http://sasapi.googlecode.com/"</span>, x:<span class="num_const">5</span>, y:-<span class="num_const">1</span>, w:<span class="num_const">500</span>, h:TH, c:0x6C8297, a:<span class="num_const">100</span>}
<span class="lineno" id="39">    39  </span>				}, fps:{n:<span class="str_const">"fpsMc"</span>, x:CW - <span class="num_const">120</span>, y:<span class="num_const">0</span>, w:<span class="num_const">110</span>, h:TH, updateRate:<span class="num_const">10</span>, bg:{n:<span class="str_const">"bgMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:<span class="num_const">110</span>, h:TH - <span class="num_const">2</span>, c:0xFFFFFF, a:<span class="num_const">0</span>}, textfields:{
<span class="lineno" id="40">    40  </span>						trend_colors:{up:<span class="str_const">"#009900"</span>, down:<span class="str_const">"#CC0000"</span>}, current_label:{n:<span class="str_const">"currentLabelTf"</span>, t:<span class="str_const">"current"</span>, x:<span class="num_const">0</span>, y:-<span class="num_const">1</span>, w:<span class="num_const">42</span>, h:TH, c:0x6C8297, a:<span class="num_const">100</span>}, current_fps:{n:<span class="str_const">"currentFpsTf"</span>, t:<span class="str_const">"00"</span>, html:<span class="key">true</span>, x:<span class="num_const">32</span>, y:-<span class="num_const">1</span>, w:<span class="num_const">25</span>, h:TH, c:0x6C8297, a:<span class="num_const">100</span>}, average_label:{n:<span class="str_const">"averageLabelTf"</span>, t:<span class="str_const">"average"</span>, x:<span class="num_const">55</span>, y:-<span class="num_const">1</span>, w:<span class="num_const">42</span>, h:TH, c:0x6C8297, a:<span class="num_const">100</span>}, average_fps:{n:<span class="str_const">"averageFpsTf"</span>, t:<span class="str_const">"00"</span>, html:<span class="key">true</span>, x:<span class="num_const">91</span>, y:-<span class="num_const">1</span>, w:<span class="num_const">25</span>, h:TH, c:0x6C8297, a:<span class="num_const">100</span>}
<span class="lineno" id="41">    41  </span>					}
<span class="lineno" id="42">    42  </span>				}				
<span class="lineno" id="43">    43  </span>			}, holder:{
<span class="lineno" id="44">    44  </span>				n:<span class="str_const">"holderMc"</span>, x:<span class="num_const">0</span>, y:IH, w:<span class="num_const">0</span>, h:<span class="num_const">0</span>, list:{n:<span class="str_const">"listMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:<span class="num_const">0</span>, h:<span class="num_const">0</span>}, mask:{n:<span class="str_const">"maskMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:IW, h:CH - IH, c:0x00ffff, a:<span class="num_const">100</span>}, gutter:{n:<span class="str_const">"gutterMc"</span>, x:CW - <span class="num_const">10</span>, y:<span class="num_const">0</span>, w:<span class="num_const">10</span>, h:CH - IH, c:0x000000, a:<span class="num_const">100</span>}, bar:{n:<span class="str_const">"barMc"</span>, x:CW - <span class="num_const">10</span>, y:<span class="num_const">0</span>, w:<span class="num_const">10</span>, h:<span class="num_const">165</span>, c:0x6C8297, a:<span class="num_const">100</span>} <span class="comment">// c:0xCC3300, a:30</span>
<span class="lineno" id="45">    45  </span>			}, resizer:{n:<span class="str_const">"resizerMc"</span>, x:CW - <span class="num_const">10</span>, y:CH - <span class="num_const">10</span>, w:<span class="num_const">10</span>, h:<span class="num_const">10</span>, c:0xFFFFFF, a:<span class="num_const">100</span>}
<span class="lineno" id="46">    46  </span>		}, item:{
<span class="lineno" id="47">    47  </span>			n:<span class="str_const">"itemMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:IW, h:IH, bg:{n:<span class="str_const">"bgMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:IW, h:IH, c:[ 0x202020, 0x000000 ], cindex:<span class="num_const">1</span>, a:<span class="num_const">50</span>}, line:{n:<span class="str_const">"lineMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:IW, h:<span class="num_const">1</span>, c:0xFFFFFF, a:<span class="num_const">50</span>}, textfields:{
<span class="lineno" id="48">    48  </span>				id:{n:<span class="str_const">"idTf"</span>, t:<span class="str_const">"id"</span>, x:<span class="num_const">5</span>, y:<span class="num_const">0</span>, w:<span class="num_const">30</span>, h:TH, c:0x999999, a:<span class="num_const">100</span>}, type:{n:<span class="str_const">"typeTf"</span>, t:<span class="str_const">"type"</span>, x:<span class="num_const">40</span>, y:<span class="num_const">0</span>, w:<span class="num_const">40</span>, h:TH, a:<span class="num_const">100</span>, c:{
<span class="lineno" id="49">    49  </span>					trace:0xFF00FF, info:0x00FFFF, status:0x99FF00, warn:0xFFFF00, error:0xFF9900, fatal:0xFF0000, object:0x9900FF, custom:0x0066FF}
<span class="lineno" id="50">    50  </span>				}, origin:{n:<span class="str_const">"originTf"</span>, t:<span class="str_const">"origin"</span>, selectable:<span class="key">false</span>, x:<span class="num_const">85</span>, y:<span class="num_const">0</span>, w:<span class="num_const">90</span>, h:TH, c:0x6C8297, a:<span class="num_const">100</span>}, message:{n:<span class="str_const">"messageTf"</span>, t:<span class="str_const">"message"</span>, selectable:<span class="key">true</span>, x:<span class="num_const">180</span>, y:<span class="num_const">0</span>, w:<span class="num_const">650</span>, h:TH, c:0xF7F7F7, a:<span class="num_const">100</span>}, benchmark:{n:<span class="str_const">"benchmarkTf"</span>, t:<span class="str_const">"benchmark"</span>, x:<span class="num_const">835</span>, y:<span class="num_const">0</span>, w:<span class="num_const">51</span>, h:TH, c:0x999999, a:<span class="num_const">100</span>}					
<span class="lineno" id="51">    51  </span>			}
<span class="lineno" id="52">    52  </span>		}, meta_item:{
<span class="lineno" id="53">    53  </span>			n:<span class="str_const">"metaItemMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:IW, h:IH, bg:{n:<span class="str_const">"bgMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:IW, h:IH, c:0x000000, a:<span class="num_const">95</span>}, line:{n:<span class="str_const">"lineMc"</span>, x:<span class="num_const">0</span>, y:<span class="num_const">0</span>, w:IW, h:<span class="num_const">1</span>, c:0xFFFFFF, a:<span class="num_const">50</span>}, textfields:{
<span class="lineno" id="54">    54  </span>				id:{n:<span class="str_const">"idTf"</span>, t:<span class="str_const">"id"</span>, x:<span class="num_const">5</span>, y:<span class="num_const">0</span>, w:<span class="num_const">30</span>, h:TH, c:0x666666, a:<span class="num_const">100</span>}, type:{n:<span class="str_const">"typeTf"</span>, t:<span class="str_const">"type"</span>, x:<span class="num_const">40</span>, y:<span class="num_const">0</span>, w:<span class="num_const">40</span>, h:TH, c:0x666666, a:<span class="num_const">100</span>}, origin:{n:<span class="str_const">"originTf"</span>, t:<span class="str_const">"origin"</span>, x:<span class="num_const">85</span>, y:<span class="num_const">0</span>, w:<span class="num_const">90</span>, h:TH, c:0x666666, a:<span class="num_const">100</span>}, message:{n:<span class="str_const">"messageTf"</span>, t:<span class="str_const">"message"</span>, x:<span class="num_const">180</span>, y:<span class="num_const">0</span>, w:<span class="num_const">650</span>, h:TH, c:0x666666, a:<span class="num_const">100</span>}, benchmark:{n:<span class="str_const">"benchmarkTf"</span>, t:<span class="str_const">"benchmark"</span>, x:<span class="num_const">835</span>, y:<span class="num_const">0</span>, w:<span class="num_const">51</span>, h:TH, c:0x666666, a:<span class="num_const">100</span>}					
<span class="lineno" id="55">    55  </span>			}
<span class="lineno" id="56">    56  </span>		}
<span class="lineno" id="57">    57  </span>	};	
<span class="lineno" id="58">    58  </span>
<span class="lineno" id="59">    59  </span>	<span class="comment doc">/**
<span class="lineno" id="60">    60  </span>	 * Singleton Private Constructor
<span class="lineno" id="61">    61  </span>	 */</span>
<span class="lineno" id="62">    62  </span>	<span class="key">private</span> <span class="key">function</span> ConsoleStyle() {
<span class="lineno" id="63">    63  </span>	}
<span class="lineno" id="64">    64  </span>
<span class="lineno" id="65">    65  </span>	<span class="comment doc">/**
<span class="lineno" id="66">    66  </span>	 * Singleton Accessor
<span class="lineno" id="67">    67  </span>	 * @return ConsoleStyle
<span class="lineno" id="68">    68  </span>	 */</span>	
<span class="lineno" id="69">    69  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> getInstance():ConsoleStyle {
<span class="lineno" id="70">    70  </span>		<span class="key">if</span> (!_instance) _instance = <span class="key">new</span> ConsoleStyle( );
<span class="lineno" id="71">    71  </span>		<span class="key">return</span> _instance;
<span class="lineno" id="72">    72  </span>	}
<span class="lineno" id="73">    73  </span>
<span class="lineno" id="74">    74  </span>	<span class="comment doc">/**
<span class="lineno" id="75">    75  </span>	 * Shorthand Singleton Accessor Getter
<span class="lineno" id="76">    76  </span>	 */</span>
<span class="lineno" id="77">    77  </span>	<span class="key">public</span> <span class="key">static</span> <span class="key">function</span> get $():ConsoleStyle {
<span class="lineno" id="78">    78  </span>		<span class="key">return</span> ConsoleStyle.getInstance( );	
<span class="lineno" id="79">    79  </span>	}	
<span class="lineno" id="80">    80  </span>
<span class="lineno" id="81">    81  </span>	<span class="comment doc">/**
<span class="lineno" id="82">    82  </span>	 * Create an empty BaseClip - but do not inherit x,y,w,h from 'style' arg.
<span class="lineno" id="83">    83  </span>	 * @param target (MovieClip)
<span class="lineno" id="84">    84  </span>	 * @param style (Object) ConsoleStyle.CSS reference obj
<span class="lineno" id="85">    85  </span>	 * @return MovieClip
<span class="lineno" id="86">    86  </span>	 * {@code Usage:
<span class="lineno" id="87">    87  </span>	 * 	ar e:MovieClip = ConsoleStyle.$.createClip(_root, ConsoleStyle.$.CSS.console.item.bg);
<span class="lineno" id="88">    88  </span>	 * }
<span class="lineno" id="89">    89  </span>	 */</span>
<span class="lineno" id="90">    90  </span>	<span class="key">public</span> <span class="key">function</span> createClip(target:MovieClip, style:Object):MovieClip {
<span class="lineno" id="91">    91  </span>		<span class="key">return</span> ClassUtils.createEmptyMovieClip( com.sekati.display.BaseClip, target, style.n );
<span class="lineno" id="92">    92  </span>	}
<span class="lineno" id="93">    93  </span>
<span class="lineno" id="94">    94  </span>	<span class="comment doc">/**
<span class="lineno" id="95">    95  </span>	 * Create an empty BaseClip which inherits x,y from 'style' arg.
<span class="lineno" id="96">    96  </span>	 * @param target (MovieClip)
<span class="lineno" id="97">    97  </span>	 * @param style (Object) ConsoleStyle.CSS reference obj
<span class="lineno" id="98">    98  </span>	 * @return MovieClip
<span class="lineno" id="99">    99  </span>	 * {@code Usage:
<span class="lineno" id="100">   100  </span>	 * 	ar e:MovieClip = ConsoleStyle.$.createPositionClip(_root, ConsoleStyle.$.CSS.console.container);
<span class="lineno" id="101">   101  </span>	 * }
<span class="lineno" id="102">   102  </span>	 */</span>
<span class="lineno" id="103">   103  </span>	<span class="key">public</span> <span class="key">function</span> createPositionClip(target:MovieClip, style:Object):MovieClip {
<span class="lineno" id="104">   104  </span>		<span class="key">return</span> ClassUtils.createEmptyMovieClip( com.sekati.display.BaseClip, target, style.n, {_x:style.x, _y:style.y, _alpha:style.a} );
<span class="lineno" id="105">   105  </span>	}
<span class="lineno" id="106">   106  </span>
<span class="lineno" id="107">   107  </span>	<span class="comment doc">/**
<span class="lineno" id="108">   108  </span>	 * Create a styled rectangle BaseClip
<span class="lineno" id="109">   109  </span>	 * @param target (MovieClip)
<span class="lineno" id="110">   110  </span>	 * @param style (Object) ConsoleStyle.CSS reference obj
<span class="lineno" id="111">   111  </span>	 * @return MovieClip
<span class="lineno" id="112">   112  </span>	 * {@code Usage:
<span class="lineno" id="113">   113  </span>	 * 	var r:MovieClip = ConsoleStyle.$.createStyledRectangle (_this, ConsoleStyle.$.CSS.item.bg);
<span class="lineno" id="114">   114  </span>	 * }
<span class="lineno" id="115">   115  </span>	 */</span>
<span class="lineno" id="116">   116  </span>	<span class="key">public</span> <span class="key">function</span> createStyledRectangle(target:MovieClip, style:Object):MovieClip {
<span class="lineno" id="117">   117  </span>		<span class="comment">// create the shape container clip</span>
<span class="lineno" id="118">   118  </span>		<span class="key">var</span> r:MovieClip = createClip( target, style );	
<span class="lineno" id="119">   119  </span>		<span class="comment">// sanitize style.c - if it is an array (instead of a number) it means we need to alternate colors with style.cindex</span>
<span class="lineno" id="120">   120  </span>		<span class="key">var</span> c:Number = (style.c <span class="key">instanceof</span> Array) ? alternateItemBgColor( ) : style.c;
<span class="lineno" id="121">   121  </span>		<span class="comment">//trace("drawing rect: "+style.n+": "+c);</span>
<span class="lineno" id="122">   122  </span>		Rectangle.draw( r, <span class="key">new</span> Point( <span class="num_const">0</span>, <span class="num_const">0</span> ), <span class="key">new</span> Point( style.w, style.h ), c, style.a );
<span class="lineno" id="123">   123  </span>		r._x = style.x;
<span class="lineno" id="124">   124  </span>		r._y = style.y;
<span class="lineno" id="125">   125  </span>		<span class="key">return</span> r;
<span class="lineno" id="126">   126  </span>	}
<span class="lineno" id="127">   127  </span>
<span class="lineno" id="128">   128  </span>	<span class="comment doc">/**
<span class="lineno" id="129">   129  </span>	 * Create a styled triangle BaseClip
<span class="lineno" id="130">   130  </span>	 * @param target (MovieClip)
<span class="lineno" id="131">   131  </span>	 * @param style (Object) ConsoleStyle.CSS reference obj
<span class="lineno" id="132">   132  </span>	 * @return MovieClip
<span class="lineno" id="133">   133  </span>	 */</span>
<span class="lineno" id="134">   134  </span>	<span class="key">public</span> <span class="key">function</span> createStyledTriangle(target:MovieClip, style:Object):MovieClip {
<span class="lineno" id="135">   135  </span>		<span class="key">var</span> t:MovieClip = createClip( target, style );
<span class="lineno" id="136">   136  </span>		Triangle.draw( t, <span class="key">new</span> Point( style.w, style.h ), <span class="key">new</span> Point( <span class="num_const">0</span>, style.h ), <span class="key">new</span> Point( style.w, <span class="num_const">0</span> ), style.c, style.a, <span class="num_const">0</span> );
<span class="lineno" id="137">   137  </span>		t._x = style.x;
<span class="lineno" id="138">   138  </span>		t._y = style.y;
<span class="lineno" id="139">   139  </span>		<span class="key">return</span> t;	
<span class="lineno" id="140">   140  </span>	}
<span class="lineno" id="141">   141  </span>
<span class="lineno" id="142">   142  </span>	<span class="comment doc">/**
<span class="lineno" id="143">   143  </span>	 * Alternate the item bg color to create "zebra striped" item entries.
<span class="lineno" id="144">   144  </span>	 * @return Number - item bg color
<span class="lineno" id="145">   145  </span>	 */</span>
<span class="lineno" id="146">   146  </span>	<span class="key">private</span> <span class="key">function</span> alternateItemBgColor():Number {
<span class="lineno" id="147">   147  </span>		CSS.item.bg.cindex = (CSS.item.bg.cindex == <span class="num_const">1</span>) ? <span class="num_const">0</span> : <span class="num_const">1</span>;
<span class="lineno" id="148">   148  </span>		<span class="comment">//trace("alternateColor ["+CSS.item.bg.cindex+"] called: "+CSS.item.bg.c[CSS.item.bg.cindex]);</span>
<span class="lineno" id="149">   149  </span>		<span class="key">return</span> CSS.item.bg.c[CSS.item.bg.cindex];
<span class="lineno" id="150">   150  </span>	}	
<span class="lineno" id="151">   151  </span>
<span class="lineno" id="152">   152  </span>	<span class="comment doc">/**
<span class="lineno" id="153">   153  </span>	 * Create a styled textfield
<span class="lineno" id="154">   154  </span>	 * @param target (MovieClip)
<span class="lineno" id="155">   155  </span>	 * @param style (Object) ConsoleStyle.CSS reference obj
<span class="lineno" id="156">   156  </span>	 * @param str (String) contents of textfield [i.e. "trace"]
<span class="lineno" id="157">   157  </span>	 * @return TextField
<span class="lineno" id="158">   158  </span>	 * {@code Usage:
<span class="lineno" id="159">   159  </span>	 * 	var tf:TextField = ConsoleStyle.$.createStyledTextField(_this, ConsoleStyle.$.CSS.item.textfields.origin, "hello world");
<span class="lineno" id="160">   160  </span>	 * }
<span class="lineno" id="161">   161  </span>	 */</span>
<span class="lineno" id="162">   162  </span>	<span class="key">public</span> <span class="key">function</span> createStyledTextField(target:MovieClip, style:Object, str:String):TextField {
<span class="lineno" id="163">   163  </span>		<span class="comment">// if no 'str' arg was passed use default style.t text</span>
<span class="lineno" id="164">   164  </span>		<span class="key">var</span> s:String = (str != undefined) ? str : style.t;
<span class="lineno" id="165">   165  </span>		<span class="comment">// if style.c is an Object (instead of number) assume we are a message type and resolve the color based on 'str' arg.</span>
<span class="lineno" id="166">   166  </span>		<span class="key">var</span> c:Number = (!isNaN( style.c )) ? style.c : resolveTypeColor( str );
<span class="lineno" id="167">   167  </span>		<span class="comment">// if 'messageTf' || 'originTf' then make autoSize, multiLine, wordWrap, selectable true; else default to false.</span>
<span class="lineno" id="168">   168  </span>		<span class="key">var</span> isSizable:Boolean = (style.n == CSS.item.textfields.message.n || style.n == CSS.item.textfields.origin.n);
<span class="lineno" id="169">   169  </span>		<span class="comment">// see if we want to be an html textfield</span>
<span class="lineno" id="170">   170  </span>		<span class="key">var</span> isHtml:Boolean = (style.html == <span class="key">true</span>) ? <span class="key">true</span> : <span class="key">false</span>;
<span class="lineno" id="171">   171  </span>		<span class="comment">// see if we want a selectable textfield</span>
<span class="lineno" id="172">   172  </span>		<span class="key">var</span> isSelectable:Boolean = (style.selectable == <span class="key">true</span>) ? <span class="key">true</span> : <span class="key">false</span>;
<span class="lineno" id="173">   173  </span>		<span class="comment">// build properties and format objects</span>
<span class="lineno" id="174">   174  </span>		<span class="key">var</span> props:Object = {type:<span class="str_const">"dynamic"</span>, html:isHtml, autoSize:isSizable, wordWrap:isSizable, multiline:isSizable, selectable:isSelectable, mouseWheelEnabled:<span class="key">false</span>, embedFonts:<span class="key">false</span>, _alpha:style.a, htmlText:s};		
<span class="lineno" id="175">   175  </span>		<span class="key">var</span> format:Object = {font:<span class="str_const">"Arial"</span>, size:<span class="num_const">9</span>, color:c};
<span class="lineno" id="176">   176  </span>		<span class="comment">// create the TextField now that we have good properties, formats and string.</span>
<span class="lineno" id="177">   177  </span>		<span class="key">var</span> t:TextField = TextUtils.create( target, style.n, style.x, style.y, style.w, style.h, props, format );
<span class="lineno" id="178">   178  </span>		<span class="key">return</span> t;
<span class="lineno" id="179">   179  </span>	}		
<span class="lineno" id="180">   180  </span>
<span class="lineno" id="181">   181  </span>	<span class="comment doc">/**
<span class="lineno" id="182">   182  </span>	 * Compare the type string argument to those existing in the ConsoleStyle.COLOR.item.textfields.type style,
<span class="lineno" id="183">   183  </span>	 * if one matches return it, else default to the 'custom' style.
<span class="lineno" id="184">   184  </span>	 * @param type (String) type as string
<span class="lineno" id="185">   185  </span>	 * @return Number
<span class="lineno" id="186">   186  </span>	 * {@code Usage:
<span class="lineno" id="187">   187  </span>	 * 	var c:Number = resolveTypeColor("trace"); // returns CSS.item.textfields.type.c.trace
<span class="lineno" id="188">   188  </span>	 * 	var c:Number = resolveTypeColor("sekati"); // returns CSS.item.textfields.type.c.custom
<span class="lineno" id="189">   189  </span>	 * }
<span class="lineno" id="190">   190  </span>	 */</span>
<span class="lineno" id="191">   191  </span>	<span class="key">private</span> <span class="key">function</span> resolveTypeColor(type:String):Number {
<span class="lineno" id="192">   192  </span>		<span class="key">var</span> t:String = type.toLowerCase( );
<span class="lineno" id="193">   193  </span>		<span class="key">var</span> c:Number = (!CSS.item.textfields.type.c[t]) ? CSS.item.textfields.type.c.custom : CSS.item.textfields.type.c[t];
<span class="lineno" id="194">   194  </span>		<span class="comment">//trace("resolveTypeColor: "+t+": "+ c);</span>
<span class="lineno" id="195">   195  </span>		<span class="key">return</span> c;
<span class="lineno" id="196">   196  </span>	}
<span class="lineno" id="197">   197  </span>}</pre><ul class="main_nav" id="main_nav"><li><a href="../../../overview-summary.html" title="Overview of SASAPI" class="button">Overview</a></li><li><a href="package-summary.html" title="Overview of package com.sekati.log" class="button">Package</a></li><li><a href="ConsoleStyle.html" title="Detail of com.sekati.log.ConsoleStyle API" class="button">Class</a></li><li><span class="button nav_current">Source</span></li><li><a href="../../../index-files/index.html" title="Alpabetical index of types and members" class="button">Index</a></li></ul><div class="footer"><a href="http://www.badgers-in-foil.co.uk/projects/as2api/" title="ActionScript 2 API Documentation Generator">as2api</a></div></body></html>